package com.ethink.component.warehouse;

import cn.hutool.extra.spring.SpringUtil;
import com.ethink.component.warehouse.properties.WarehouseComponentProperties;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 仓库集成client
 */
@Component
public class WarehouseClient {

    @Autowired
    private WarehouseComponentProperties properties;

    public WarehouseInter getWarehouseService(String warehouseCode) {
        String beanName = properties.getBeanMap().get(warehouseCode);
        return StringUtils.isBlank(beanName) ? null : SpringUtil.getBean(beanName);
    }

}
